﻿<%@ Page Title="" Language="VB" MasterPageFile="~/Master/Site_InnerWeb.master" AutoEventWireup="false"
    CodeFile="Recipients.aspx.vb" Inherits="private_secure_members_pages_Recipients" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <h1>
        Manage who will receive messages from you</h1>
    <div>
        <table id="table1" class="style1">
            <tr>
                <td valign="top">
                    Select one of your Lists or Create a New One</td>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td valign="top">
                    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlTargetList_ds"
                        DataTextField="Name" DataValueField="ID" Width="200px">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlTargetList_ds" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                        SelectCommand="usp_TargetListSelectByEntityId_DDL" SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:Parameter Name="EntityID" Type="Int32" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
                <td valign="top">
                    <strong>Actions</strong><br />
                    Populate your list - Data Entry<br />
                    Load Data From File<br />
                    Load Data From Another List<br />
                    Generate an empty file that the user can load</td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td valign="top">
                    On this page a user must be able to Add, Edit, Delete Recipients. 
                    <br />
                    And for the selected Recipient edit the Extra information</td>
                <td>
                    &nbsp;
                </td>
                <td>
                   &nbsp;
                </td>
            </tr>
            <tr>
                <td valign="top">
                    <strong>Recipient for your Selected List
                </strong>
                </td>
                <td valign="top">
                    Extra Detail for your selected List<br />
                    Below disable the columns that are not
                    <br />
                    in the user&#39;s target</td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td valign="top">
                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
                        AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="SqlRecipients_ds">
                        <Columns>
                            <asp:CommandField ShowEditButton="True" ShowSelectButton="True">
                            </asp:CommandField>
                            <asp:BoundField DataField="RowNum" HeaderText="#" ReadOnly="True" SortExpression="RowNum" />
                            <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" ReadOnly="True"
                                SortExpression="Id" Visible="False" />
                            <asp:BoundField DataField="CustomRefId" HeaderText="CustomRefId" SortExpression="CustomRefId" />
                            <asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" />
                            <asp:BoundField DataField="HomeEmailAddress" HeaderText="Home Email" SortExpression="HomeEmailAddress" />
                            <asp:BoundField DataField="WorkEmailAddress" HeaderText="Work Email" SortExpression="WorkEmailAddress" />
                            <asp:BoundField DataField="MobileNo" HeaderText="Mobile" SortExpression="MobileNo" />
                            <asp:BoundField DataField="DateAddedToList" HeaderText="Date Added" SortExpression="DateAddedToList" />
                        </Columns>
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlRecipients_ds" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                        DeleteCommand="usp_RecipientDelete" DeleteCommandType="StoredProcedure" InsertCommand="usp_RecipientInsert"
                        InsertCommandType="StoredProcedure" SelectCommand="usp_RecipientsByTargetListId_Grid"
                        SelectCommandType="StoredProcedure" UpdateCommand="usp_RecipientUpdate" UpdateCommandType="StoredProcedure">
                        <DeleteParameters>
                            <asp:Parameter Name="Id" Type="Int32" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="CustomRefId" Type="String" />
                            <asp:Parameter Name="FirstName" Type="String" />
                            <asp:Parameter Name="HomeEmailAddress" Type="String" />
                            <asp:Parameter Name="WorkEmailAddress" Type="String" />
                            <asp:Parameter Name="MobileNo" Type="String" />
                            <asp:Parameter Name="DateAddedToList" Type="DateTime" />
                            <asp:Parameter Name="Active" Type="Boolean" />
                        </InsertParameters>
                        <SelectParameters>
                            <asp:ControlParameter ControlID="DropDownList1" Name="TargetListid" PropertyName="SelectedValue"
                                Type="Int32" />
                        </SelectParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="Id" Type="Int32" />
                            <asp:Parameter Name="CustomRefId" Type="String" />
                            <asp:Parameter Name="FirstName" Type="String" />
                            <asp:Parameter Name="HomeEmailAddress" Type="String" />
                            <asp:Parameter Name="WorkEmailAddress" Type="String" />
                            <asp:Parameter Name="MobileNo" Type="String" />
                            <asp:Parameter Name="DateAddedToList" Type="DateTime" />
                            <asp:Parameter Name="Active" Type="Boolean" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                </td>
                <td valign="top">
                    <asp:FormView ID="FormView1" runat="server" DataKeyNames="Id" DataSourceID="SqlRecipientsExtra_ds">
                        <EditItemTemplate>
                            <table id="tablefv_Edit" class="style1">
                                <tr>
                                    <td>
                                        Id:
                                    </td>
                                    <td>
                                        <asp:Label ID="IdLabel1" runat="server" Text='<%# Eval("Id") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Last Name:
                                    </td>
                                    <td>
                                        <asp:TextBox ID="LastNameTextBox" runat="server" Text='<%# Bind("LastName") %>' />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Is Adult:
                                    </td>
                                    <td>
                                        <asp:CheckBox ID="IsAdultCheckBox2" runat="server" Checked='<%# Bind("IsAdult") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Gender:
                                    </td>
                                    <td>
                                        <asp:TextBox ID="GenderTextBox" runat="server" Text='<%# Bind("Gender") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        NI No.
                                    </td>
                                    <td>
                                        <asp:TextBox ID="NI_NumberTextBox" runat="server" Text='<%# Bind("NI_Number") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        SSN (US):
                                    </td>
                                    <td>
                                        <asp:TextBox ID="SS_NumberTextBox" runat="server" Text='<%# Bind("SS_Number") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Birth Month:
                                    </td>
                                    <td>
                                        <asp:TextBox ID="BirthMonthTextBox" runat="server" Text='<%# Bind("BirthMonth") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Birth Day:
                                    </td>
                                    <td>
                                        <asp:TextBox ID="BirthDayTextBox" runat="server" Text='<%# Bind("BirthDay") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Birth Year:
                                    </td>
                                    <td>
                                        <asp:TextBox ID="BirthYearTextBox" runat="server" Text='<%# Bind("BirthYear") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Post Code:
                                    </td>
                                    <td>
                                        <asp:TextBox ID="PostCodeTextBox" runat="server" Text='<%# Bind("PostCode") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        House No.
                                    </td>
                                    <td>
                                        <asp:TextBox ID="HouseNoTextBox" runat="server" Text='<%# Bind("HouseNo") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Occupation Note:
                                    </td>
                                    <td>
                                        <asp:TextBox ID="OccupationNoteTextBox" runat="server" Text='<%# Bind("OccupationNote") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Is Local:
                                    <td>
                                        <asp:CheckBox ID="IsLocalCheckBox" runat="server" 
                                            Checked='<%# Bind("IsLocal") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Active:
                                    </td>
                                    <td>
                                        <asp:CheckBox ID="ActiveCheckBox" runat="server" Checked='<%# Bind("Active") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                            </table>
                            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                                Text="Update" />
                            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False"
                                CommandName="Cancel" Text="Cancel" />
                        </EditItemTemplate>
                        <EmptyDataTemplate>
                            No extra information is being stored for the selected Recipient
                        </EmptyDataTemplate>
                        <InsertItemTemplate>
                            <table id="table2" class="style1">
                                <tr>
                                    <td>
                                        Id:
                                    </td>
                                    <td>
                                        <asp:Label ID="IdLabel2" runat="server" Text='<%# Bind("Id") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Last Name:
                                    </td>
                                    <td>
                                        <asp:TextBox ID="LastNameTextBox" runat="server" Text='<%# Bind("LastName") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Is Adult:
                                    </td>
                                    <td>
                                        <asp:CheckBox ID="IsAdultCheckBox" runat="server" Checked='<%# Bind("IsAdult") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Gender:
                                    </td>
                                    <td>
                                        <asp:TextBox ID="GenderTextBox" runat="server" Text='<%# Bind("Gender") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        NI_No.:
                                    </td>
                                    <td>
                                        <asp:TextBox ID="NI_NumberTextBox" runat="server" Text='<%# Bind("NI_Number") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        SSN (US)
                                    </td>
                                    <td>
                                        <asp:TextBox ID="SS_NumberTextBox" runat="server" Text='<%# Bind("SS_Number") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Birth Month:
                                    </td>
                                    <td>
                                        <asp:TextBox ID="BirthMonthTextBox" runat="server" Text='<%# Bind("BirthMonth") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Birth Day:
                                    </td>
                                    <td>
                                        <asp:TextBox ID="BirthDayTextBox" runat="server" Text='<%# Bind("BirthDay") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Birth Year:
                                    </td>
                                    <td>
                                        <asp:TextBox ID="BirthYearTextBox" runat="server" Text='<%# Bind("BirthYear") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Post code:</td>
                                    <td>
                                        <asp:TextBox ID="PostCodeTextBox" runat="server" Text='<%# Bind("PostCode") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        House No. :</td>
                                    <td>
                                        <asp:TextBox ID="HouseNoTextBox" runat="server" Text='<%# Bind("HouseNo") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Occupation Note:
                                    </td>
                                    <td>
                                        <asp:TextBox ID="OccupationNoteTextBox" runat="server" Text='<%# Bind("OccupationNote") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        IsLocal:
                                    </td>
                                    <td>
                                        <asp:CheckBox ID="IsLocalCheckBox" runat="server" Checked='<%# Bind("IsLocal") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Active:
                                    </td>
                                    <td>
                                        <asp:CheckBox ID="ActiveCheckBox" runat="server" Checked='<%# Bind("Active") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                            </table>
                            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                                Text="Insert" />
                            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False"
                                CommandName="Cancel" Text="Cancel" />
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <table id="table2" class="style1">
                                <tr>
                                    <td>
                                        Id:
                                    </td>
                                    <td>
                                        <asp:Label ID="IdLabel" runat="server" Text='<%# Eval("Id") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Last Name
                                    </td>
                                    <td>
                                        <asp:Label ID="LastNameLabel" runat="server" Text='<%# Bind("LastName") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        IsAdult:
                                    </td>
                                    <td>
                                        <asp:CheckBox ID="IsAdultCheckBox" runat="server" Checked='<%# Bind("IsAdult") %>'
                                            Enabled="false" />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Gender:
                                    </td>
                                    <td>
                                        <asp:Label ID="GenderLabel2" runat="server" Text='<%# Bind("Gender") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        NI Number
                                    </td>
                                    <td>
                                        <asp:Label ID="NI_NumberLabel" runat="server" Text='<%# Bind("NI_Number") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        SSN (US)
                                    </td>
                                    <td>
                                        <asp:Label ID="SS_NumberLabel" runat="server" Text='<%# Bind("SS_Number") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Birth Month
                                    </td>
                                    <td>
                                        <asp:Label ID="BirthMonthLabel" runat="server" Text='<%# Bind("BirthMonth") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Birth Day
                                    </td>
                                    <td>
                                        <asp:Label ID="BirthDayLabel" runat="server" Text='<%# Bind("BirthDay") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Birth Year
                                    </td>
                                    <td>
                                        <asp:Label ID="BirthYearLabel" runat="server" Text='<%# Bind("BirthYear") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Postcode
                                    </td>
                                    <td>
                                        <asp:Label ID="PostCodeLabel" runat="server" Text='<%# Bind("PostCode") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        House No
                                    </td>
                                    <td>
                                        <asp:Label ID="HouseNoLabel" runat="server" Text='<%# Bind("HouseNo") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Occupation Note
                                    </td>
                                    <td>
                                        <asp:Label ID="OccupationNoteLabel" runat="server" Text='<%# Bind("OccupationNote") %>' />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Is Local
                                    </td>
                                    <td>
                                        <asp:CheckBox ID="IsLocalCheckBox" runat="server" Checked='<%# Bind("IsLocal") %>'
                                            Enabled="false" />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Active
                                    </td>
                                    <td>
                                        <asp:CheckBox ID="ActiveCheckBox" runat="server" Checked='<%# Bind("Active") %>'
                                            Enabled="false" />
                                    </td>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                            </table>
                            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
                                Text="Edit" />
                            &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
                                Text="Delete" />
                            &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
                                Text="New" />
                        </ItemTemplate>
                    </asp:FormView>
                    <asp:SqlDataSource ID="SqlRecipientsExtra_ds" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                        DeleteCommand="usp_RecipientExtraDelete" DeleteCommandType="StoredProcedure"
                        InsertCommand="usp_RecipientExtraInsert" InsertCommandType="StoredProcedure"
                        SelectCommand="usp_RecipientExtraSelect" SelectCommandType="StoredProcedure"
                        UpdateCommand="usp_RecipientExtraUpdate" UpdateCommandType="StoredProcedure">
                        <DeleteParameters>
                            <asp:Parameter Name="Id" Type="Int32" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="Id" Type="Int32" />
                            <asp:Parameter Name="LastName" Type="String" />
                            <asp:Parameter Name="IsAdult" Type="Boolean" />
                            <asp:Parameter Name="Gender" Type="String" />
                            <asp:Parameter Name="NI_Number" Type="String" />
                            <asp:Parameter Name="SS_Number" Type="String" />
                            <asp:Parameter Name="BirthMonth" Type="Byte" />
                            <asp:Parameter Name="BirthDay" Type="Byte" />
                            <asp:Parameter Name="BirthYear" Type="Byte" />
                            <asp:Parameter Name="PostCode" Type="String" />
                            <asp:Parameter Name="HouseNo" Type="String" />
                            <asp:Parameter Name="OccupationNote" Type="String" />
                            <asp:Parameter Name="IsLocal" Type="Boolean" />
                            <asp:Parameter Name="Active" Type="Boolean" />
                        </InsertParameters>
                        <SelectParameters>
                            <asp:ControlParameter ControlID="GridView1" Name="Id" PropertyName="SelectedValue"
                                Type="Int32" />
                        </SelectParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="Id" Type="Int32" />
                            <asp:Parameter Name="LastName" Type="String" />
                            <asp:Parameter Name="IsAdult" Type="Boolean" />
                            <asp:Parameter Name="Gender" Type="String" />
                            <asp:Parameter Name="NI_Number" Type="String" />
                            <asp:Parameter Name="SS_Number" Type="String" />
                            <asp:Parameter Name="BirthMonth" Type="Byte" />
                            <asp:Parameter Name="BirthDay" Type="Byte" />
                            <asp:Parameter Name="BirthYear" Type="Byte" />
                            <asp:Parameter Name="PostCode" Type="String" />
                            <asp:Parameter Name="HouseNo" Type="String" />
                            <asp:Parameter Name="OccupationNote" Type="String" />
                            <asp:Parameter Name="IsLocal" Type="Boolean" />
                            <asp:Parameter Name="Active" Type="Boolean" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    Panel here to Populate the List from a file</td>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
